USE EMODE
GO

------------------------------------------------
--- Filegroups creation ------------------------
------------------------------------------------

--- SHOP_FACTS ------
ALTER DATABASE EMODE ADD FILEGROUP [SHOP_FACTS_97];
ALTER DATABASE EMODE ADD FILEGROUP [SHOP_FACTS_98];
ALTER DATABASE EMODE ADD FILEGROUP [SHOP_FACTS_99];
ALTER DATABASE EMODE ADD FILEGROUP [SHOP_FACTS_00];
ALTER DATABASE EMODE ADD FILEGROUP [SHOP_FACTS_01];

--- PRODUCT_PROMOTION_FACTS -------
ALTER DATABASE EMODE ADD FILEGROUP [PRODUCT_PROMOTION_FACTS_97];
ALTER DATABASE EMODE ADD FILEGROUP [PRODUCT_PROMOTION_FACTS_98];
ALTER DATABASE EMODE ADD FILEGROUP [PRODUCT_PROMOTION_FACTS_99];
ALTER DATABASE EMODE ADD FILEGROUP [PRODUCT_PROMOTION_FACTS_00];
ALTER DATABASE EMODE ADD FILEGROUP [PRODUCT_PROMOTION_FACTS_01];

-----------------------------------------------
--- Adding files to filegroups ----------------
-----------------------------------------------

--- SHOP_FACTS ------
ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_SHOP_FACTS_97'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_SHOP_FACTS_97.ndf'
	FILENAME = N'E:\Microsoft SQL Server\MSSQL10_50_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_DEFAULT.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [SHOP_FACTS_97];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_SHOP_FACTS_98'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_SHOP_FACTS_98.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [SHOP_FACTS_98];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_SHOP_FACTS_99'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_SHOP_FACTS_99.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [SHOP_FACTS_99];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_SHOP_FACTS_00'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_SHOP_FACTS_00.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [SHOP_FACTS_00];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_SHOP_FACTS_01'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_SHOP_FACTS_01.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [SHOP_FACTS_01];

--- PRODUCT_PROMOTION_FACTS -------
ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_PRODUCT_PROMOTION_FACTS_97'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_PRODUCT_PROMOTION_FACTS_97.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [PRODUCT_PROMOTION_FACTS_97];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_PRODUCT_PROMOTION_FACTS_98'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_PRODUCT_PROMOTION_FACTS_98.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [PRODUCT_PROMOTION_FACTS_98];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_PRODUCT_PROMOTION_FACTS_99'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_PRODUCT_PROMOTION_FACTS_99.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [PRODUCT_PROMOTION_FACTS_99];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_PRODUCT_PROMOTION_FACTS_00'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_PRODUCT_PROMOTION_FACTS_00.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [PRODUCT_PROMOTION_FACTS_00];

ALTER DATABASE EMODE ADD FILE (
	  NAME = N'DATA_PRODUCT_PROMOTION_FACTS_01'
	, FILENAME = 'E:\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\EMODE_DATA_PRODUCT_PROMOTION_FACTS_01.ndf'
	, SIZE = 5MB, MAXSIZE = 100MB, FILEGROWTH = 5MB)
TO FILEGROUP [PRODUCT_PROMOTION_FACTS_01];
----------------------------------------------